package mark.tom.pistols.algorithm.encryption;

import net.iharder.Base64;

public final class Base64Encryption {

    private final static String CHARSET_UTF8 = "utf-8";

    public static byte[] encrypt(String data) throws Exception {
        return encrypt(data.getBytes(CHARSET_UTF8));
    }

    public static byte[] encrypt(byte[] data) throws Exception {
        return Base64.encodeBytesToBytes(data);
    }

    public static byte[] decrypt(String data) throws Exception {
        return decrypt(data.getBytes(CHARSET_UTF8));
    }

    public static byte[] decrypt(byte[] data) throws Exception {
        return Base64.decode(data);
    }
}
